
import React from 'react';
import { Radio, Space } from 'antd';
import { summaryExport } from '@/services/Collection';
import ExportButton from '@/components/ExportButton';

class Export extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      radioValue: 0
    }
  }

  /* 单选按钮 */
  onRadioChange = (e) => {
    const {change} = this.props;
    const value = e.target.value;
    this.setState({radioValue: value});
    change ? change(value) : null;
  }

  render() {
    const {onRadioChange} = this;
    const {radioValue} = this.state;
    const query = this.props.query;
    return (
      <Space>
        <ExportButton query={query} request={summaryExport} />
        <Radio.Group value={radioValue} onChange={onRadioChange}>
          <Radio value={0}>原有馆藏</Radio>
          <Radio value={1}>现有馆藏</Radio>
        </Radio.Group>
      </Space>
    )
  }
}

export default Export